home *** CD-ROM | disk | FTP | other *** search
- <?php
- //Incomedia WebSite X5 EMail Class. All rights reserved.
-
- class imEMail {
- var $from;
- var $to;
- var $subject;
- var $charset;
- var $text;
- var $html;
-
- var $attachments;
-
- function imEMail($from,$to,$subject,$charset) {
- $this->from = $from;
- $this->to = $to;
- $this->subject = $subject;
- $this->charset = $charset;
- }
-
- function setFrom($from) {
- $this->from = $from;
- }
-
- function setTo($to) {
- $this->to = $to;
- }
-
- function setSubject($subject) {
- $this->subject = $subject;
- }
-
- function setCharset($charset) {
- $this->charset = $charset;
- }
-
- function setText($text) {
- $this->text = $text;
- }
-
- function setHTML($html) {
- $this->html = $html;
- }
-
- function attachFile($name,$content,$mime_type) {
- $attachment['name'] = $name;
- $attachment['content'] = base64_encode($content);
- $attachment['mime_type'] = $mime_type;
- $this->attachments[] = $attachment;
- }
-
- function send() {
- $headers = "";
- $msg = "";
-
- if($this->from == "" || $this->to == "" || ($this->text == "" && $this->html == ""))
- return false;
-
- $headers .= "From: " . $this->from . "\r\n";
- $headers .= "Content-Type: text/plain;charset=" . $this->charset . "\r\n";
- $msg .= $this->text . "\r\n\r\n";
-
- $r = @mail($this->to, $this->subject, $msg, $headers);
- return $r;
- }
- }
-
- // End of file imemail.inc.php